package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Refund {
    private long rid;
    private Long rMoney;
    private Long rNumber;
    private Customer customerId;
    private ReturnGoods returnGoods;
    private Timestamp rTime;
    private Long rChager;
    private Employee employee;
    private String rDesc;
    @Basic
    @Column(name="R_DESC")
    public String getrDesc() {
        return rDesc;
    }

    public void setrDesc(String rDesc) {
        this.rDesc = rDesc;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "R_CHAGER",insertable = false,updatable = false)//设置在article表中的关联字段(外键)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }
    public Refund(long rid, Long rMoney, Long rNumber, Customer customerId, ReturnGoods returnGoods, Timestamp rTime, Long rChager) {
        this.rid = rid;
        this.rMoney = rMoney;
        this.rNumber = rNumber;
        this.customerId = customerId;
        this.returnGoods = returnGoods;
        this.rTime = rTime;
        this.rChager = rChager;
    }

    public Refund() {
    }

    @ManyToOne
    @JoinColumn(name = "CUSTOMER_ID")
    public Customer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Customer customerId) {
        this.customerId = customerId;
    }
    @OneToOne
    @JoinColumn(name = "RETURN_ID")
    public ReturnGoods getReturnGoods() {
        return returnGoods;
    }

    public void setReturnGoods(ReturnGoods returnGoods) {
        this.returnGoods = returnGoods;
    }

    @Id
    @Column(name = "RID", nullable = false, precision = 0)
    @GeneratedValue(generator = "seq",strategy = GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name = "seq",sequenceName = "crm",
            initialValue = 1,allocationSize = 1)
    public long getRid() {
        return rid;
    }

    public void setRid(long rid) {
        this.rid = rid;
    }

    @Basic
    @Column(name = "R_MONEY", nullable = true, length = 20)
    public Long getrMoney() {
        return rMoney;
    }

    public void setrMoney(Long rMoney) {
        this.rMoney = rMoney;
    }

    @Basic
    @Column(name = "R_NUMBER", nullable = true, length = 20)
    public Long getrNumber() {
        return rNumber;
    }

    public void setrNumber(Long rNumber) {
        this.rNumber = rNumber;
    }


    @Basic
    @Column(name = "R_TIME", nullable = true)
    public Timestamp getrTime() {
        return rTime;
    }

    public void setrTime(Timestamp rTime) {
        this.rTime = rTime;
    }

    @Basic
    @Column(name = "R_CHAGER", nullable = true, precision = 0)
    public Long getrChager() {
        return rChager;
    }

    public void setrChager(Long rChager) {
        this.rChager = rChager;
    }



}
